package com.javaweb.admin.mapper.kdltrans;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.javaweb.admin.entity.kdltrans.KdlTransVendor;
import com.javaweb.admin.entity.kdltrans.KdlTransVendorOper;
import com.javaweb.admin.entity.kdltrans.KdlTransVendorTruck;
import com.javaweb.admin.query.KdlTransVendorQuery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
public interface KdlTransVendorMapper extends BaseMapper<KdlTransVendor> {
    IPage<KdlTransVendor> getTransVendorList(IPage<KdlTransVendor> page, @Param("req") KdlTransVendorQuery req);

    @Select("select * from kdl_trans_vendor_oper where pid=${pid} order by oper_name")
    List<KdlTransVendorOper> getTransVendorOperList(Integer pid);

    @Select("select t1.* from kdl_trans_vendor_oper t1 inner join kdl_trans_vendor t2 on t1.pid=t2.id where t2.vendor=#{vendorname} order by oper_name")
    List<KdlTransVendorOper> getVendorOperListByName(String vendorname);

    @Select("select * from kdl_trans_vendor_truck where pid=${pid} order by plate_no")
    List<KdlTransVendorTruck> getTransVendorTruckList(Integer pid);

    @Select("select t1.* from kdl_trans_vendor_truck t1 inner join kdl_trans_vendor t2 on t1.pid=t2.id where t2.vendor=#{vendorname} order by plate_no")
    List<KdlTransVendorTruck> getVendorTruckListByName(String vendorname);
}
